from IPProxyPool.settings import MAX_SCORE
import datetime


# 数据库模型类

class Proxy():
    def __init__(self, ip, port, protocol=-1, nick_type=-1, speed=-1, area=None, score=MAX_SCORE,
                 disable_domains=[], create_time=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
                 last_tested_time='', survived_hours=-1):
        self.ip = ip
        self.port = port
        self.protocol = protocol
        self.nick_type = nick_type
        self.speed = speed
        self.area = area
        self.score = score
        self.disable_domains = disable_domains
        self.create_time = create_time
        self.last_tested_time = last_tested_time
        self.survived_hours = survived_hours

    def __str__(self):
        # 返回数据字符串
        return str(self.__dict__)
